package cn.ekuma.data.ui.android;

import java.util.ArrayList;
import java.util.List;
import com.openbravo.data.basic.BasicException;
import android.app.ProgressDialog;
import cn.ekuma.data.dao.I_DataLogic;
import cn.ekuma.data.dao.bean.I_ViewBean;

public abstract class AbstractListClassFinderActivate<T extends I_ViewBean> extends AbstractListFinderActivate<T>{

	public AbstractListClassFinderActivate(I_DataLogic dataLogic) {
		super(dataLogic);
	}

	@Override
	protected void onResume() {
		super.onResume();
		loadData();
	}
	
	protected void loadData() {
		final ProgressDialog dialog = ProgressDialog.show(this, "", 
		        "查旬中，请稍等 …", true, true);
		new Thread(){
			@Override
			public void run(){
				try {
					List<T> lists=dataLogic.listWithClassName(getFindClass().getName());
					if(lists==null)
						lists=new ArrayList();
				    mHandler.obtainMessage(MSG_SUCCESS, lists).sendToTarget();			
				} catch (BasicException e) {
					mHandler.obtainMessage(MSG_FAILURE).sendToTarget();//获取图片失败   
				}
				dialog.dismiss(); 
			}
			}.start();		
	}
	 

	public abstract Class getFindClass();
}
